<template>
	<view class="socgroupactiveresult">
		<view class=" display_flex">
			<view class="popup_title_block"></view>
			<view class="f-20 ml-10">拒绝申请</view>
		</view>
		<view class="result_textarea_box">
			<textarea class="result_textarea" v-model="refuse_reason" placeholder="请输入拒绝理由（限500字）"
				:show-confirm-bar="false" maxlength="500" :disable-default-padding="true"></textarea>
		</view>

		<view class="next_step_btn" @click="submitSocGroupActiveAudit">确认</view>
	</view>
</template>

<script>
	import {
		submitSocGroupActiveAudit,
	} from '@/api/motortime.js';
	let app = getApp()
	export default {
		data() {
			return {
				huodong_id: '',
				refuse_reason: ''
			};
		},
		onShow() {
			if (uni.getStorageSync('userinfo').is_staff == 0) {
				uni.switchTab({
					url: '/pages/index/index'
				})
			}
		},
		onLoad(options) {
			this.huodong_id = options.huodong_id ? options.huodong_id : ''
			var params = {
				event_code: 'SOC-车友会活动审核管理拒绝理由',
				path: 'pages/groupmanage/socgroupactiveresult',
				event_id: options.huodong_id ? options.huodong_id : '',
				title: '',
				source_page: '',
				value: '',
			}
			app.BurialPoint(params)
		},
		methods: {
			submitSocGroupActiveAudit() {
				var that = this
				if (that.refuse_reason == '') {
					uni.showToast({
						title: '请输入拒绝理由',
						mask: true,
						icon: 'none',
						duration: 1500
					})
					return false;
				}
				uni.showModal({
					content: '确定提交吗',
					confirmColor: '#00A0DC',
					success: function(res) {
						if (res.confirm) {
							submitSocGroupActiveAudit({
								audit_status: 2,
								huodong_id: that.huodong_id,
								refuse_reason: that.refuse_reason
							}).then(res => {
								if (res.state == 1) {
									uni.showToast({
										title: '审核成功',
										mask: true,
										icon: 'success',
										duration: 1500
									})
									uni.setStorage({
										key: 'onload',
										data: 'true',
										success() {
											setTimeout(function() {
												uni.navigateBack({
													delta: 1
												})
											}, 500)
										}
									})
								} else {
									uni.showToast({
										title: res.error[0],
										mask: true,
										icon: 'none',
										duration: 1500
									})
								}
							})
							var params = {
								event_code: 'SOC-车友会活动审核管理拒绝理由',
								path: 'pages/groupmanage/socgroupactiveresult',
								event_id: that.huodong_id,
								title: '',
								source_page: 'SOC-车友会活动审核管理拒绝理由-提交',
								value: '',
							}
							app.BurialPoint(params)
						} else if (res.cancel) {
							console.log('用户点击取消');
							that.isSubmit = true
						}
					}
				});

			}
		}
	}
</script>

<style lang="scss">
	.socgroupactiveresult {
		padding: 30rpx;

		.popup_title_block {
			width: 10rpx;
			height: 38rpx;
			background-color: #00A0DC;
		}

		.result_textarea_box {
			padding: 30rpx;
			margin-top: 40rpx;
			background-color: #F7F7F7;

			.result_textarea {
				width: 100%;
				height: 480rpx;
				font-size: 26rpx;
				line-height: 40rpx;

			}
		}


		.next_step_btn {
			display: flex;
			align-items: center;
			justify-content: center;
			color: #ffffff;
			padding: 25rpx 0;
			margin: 30rpx 0 60rpx 0;
			border-radius: 8rpx;
			background-color: #00A0DC;
		}
	}
</style>